<template>
  <div class="box">
    <el-tabs v-model="activeName" @tab-click="handleClick">
      <el-tab-pane label="借用单" name="borrow_application"></el-tab-pane>
      <el-tab-pane label="仓库借出" name="borrow_list"></el-tab-pane>
      <el-tab-pane label="资产归还" name="return_list"></el-tab-pane>
    </el-tabs>
    <router-view></router-view>
  </div>
</template>
<script>
export default {
  data() {
    return {
      activeName: "borrow_application"
    };
  },
  created() {
    this.RefreshActiveIndex();
  },
  methods: {
    handleClick(tab) {
      this.$router.push("/manager/borrow/" + tab.name);
    },
    RefreshActiveIndex() {
      let cur_path = this.$route.path;
      this.activeName = cur_path;
      // window.console.log(this.activeName)
      this.activeName = this.activeName.split("/");
      this.activeName = this.activeName[this.activeName.length - 1];
    }
  },
 watch: {
    $route(newpath) {
      let m = newpath.path.split("/");
      this.activeName = m[m.length - 1];
    }
  }
};
</script>
<style scoped>
.is-top {
  background-color: white;
}
</style>
